﻿using System.Threading.Tasks;

namespace Gasgoo.ShareLibrary.Framework.Options
{
    public class BatchItemOptions<T>
    {
        public BatchItemOptions()
        {
            this.Body = default(T)!;
            this.TaskSource = new TaskCompletionSource<Task>();
            this.TaskSource.SetResult(Task.CompletedTask);
        }

        public T Body { get; set; }
        public TaskCompletionSource<Task> TaskSource { get; set; }

        public BatchItemOptions(T body)
        {
            this.TaskSource = new TaskCompletionSource<Task>();
            this.Body = body;
        }

        public BatchItemOptions(T body, TaskCompletionSource<Task> source)
        {
            this.TaskSource = source;
            this.Body = body;
        }
    }
}
